public class HIJava {
    public static void main(String[] args) {
        String str1 = "hello java";
        String str2 = "hello java";

        if (str1.equals(str2)) {

            String noSpaceStr = str1.replace(" ", "");

            String replacedStr = noSpaceStr.replace("java", "word");

            System.out.println(replacedStr);
        } else {
            System.out.println("两个字符串不相等");
        }
    }
    }
